package bruce.controller;

import bruce.model.User;
import bruce.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/index")
@ResponseBody
public class IndexController {
    @Autowired
    private UserService userService;

    @RequestMapping("/index")
    public Object index() {
        List<User> users = new ArrayList<>();
        users.add(userService.getUserById(1));
        users.add(userService.getUserById(2));
        users.add(userService.getUserById(1));
        users.add(userService.getUserById(2));
        users.add(userService.getUserById(3));

        return users;
    }
}
